<?php
Class Template{

	/*
	* @the registry
	* @access private
	*/
	private $registry;
	
	/*
	* @Variables array
	* @access private
	*/
	private $vars = array();
	
	/**
	 *
	 * @constructor
	 *
	 * @access public
	 *
	 * @return void
	 *
	 */
	 function __construct($registry){
	 
	 	$this->registry = $registry;
	 
	 }
	 
	 /**
	  * @set undefined variables
	  * 
	  * @param string $index
	  * 
	  * @param mixed $value
	  *
	  * @return void
	  *
	  */
	  public function __set($index, $value){
	  
	  	$this->vars[$index] = $value;
	  
	  }
	  
	  function show($type, $name){
	  	
	  	$path = _ROOT . '/Views' . '/' . $type . '/' . $name . '.php';
	  	
	  	if(file_exists($path) == false){
	  		throw new Exception('Template not found in '.$path);
	  		return false;
	  	}	
	  	
	  	//Load variables
	  	foreach($this->vars as $key=>$value){
	  		$$key = $value;
	  	}
	  	
	  	include($path);
	  	
	  }
	 
	 

}
